perm filename INTERP.NEW[HAL,HE] blob
sn#167936 filedate 1975-07-10 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Interpreter itself: INTERP
C00007 ENDMK
C⊗;
;Interpreter itself: INTERP
.MACRO MAKEOP CNAME, ANAME ;Compiler name, Address name
XX CNAME
ANAME
.ENDM
;The interpreter operation table
INTOPS: MAKEOP XINVALID,INTER1 ;Illegal instruction
.INSRT INTOPS.PAL[HAL,HE]
INSEND = II ;Marks the end of the instructions
.MACRO BMPIPC ;
ADD #2,IPC(R4) ;Bump IPC
.ENDM ;
.MACRO CCC ;Clear condition code
CLR R0 ;Clear condition code
.ENDM
.MACRO SCC ;Set condition code
MOV #2,R0 ;Set condition code
.ENDM
INTERP:
MOV R3,R0 ;Save the limit of the interpreter stack for error checking.
SUB #INSTSZ-2,R0
MOV R0,-(SP) ;
INT1: MOV @IPC(R4),R0 ;R0 ← next instruction
BLE INTER1 ;Instruction out of range
CMP R0,#INSEND ;Is instruction too large?
BHI INTER1 ;Yes.
.IFNZ ALAID
JSR PC,ALDINT ;Do any break, trace necessary
MOV @IPC(R4),R0 ;
.ENDC
BMPIPC ;Bump IPC
INT2: JSR PC,@INTOPS(R0) ;Call the appropriate routine
BR INTCPL(R0) ;R0 should have an completion code. Branch accordingly.
INTCPL: BR INTSTS ;No error. Gather statistics.
HALERR INTMS2 ;Error.
INTSTS: CMP R3,(SP) ;Interpreter stack overflow?
BGE INT1 ;No. Go to next instruction.
HALERR INTMS3 ;Yes. Complain.
BR INT1 ;And go to next instruction.
INTER1: HALERR INTMS1
INTMS1: ASCIE /INTERPRETER INSTRUCTION OUT OF RANGE/
INTMS2: ASCIE /INTERPRETED INSTRUCTION RETURNED FAILURE/
INTMS3: ASCIE /INTERPRETER STACK OVERFLOW/
.IFNZ ALAID
COMMENT ⊗ ALAID information resides in the ALDOPS table parallel to
the INTOPS table. Each psuedo-op has these fields: ⊗
II == 0
XX ALDFLG ;Holds bits indicating status of tracing
ALDTRC == 1 ; Tracing bit. When set, trace this psop.
ALDBRK == 2 ; Break bit. When set, break on this psop.
XX ALDWHO ;If 0, then all interpreters. Else PCB of interpeter.
XX ALDPNM ;The RAD50 print name of the psop. Two words
OPSLTH = II/2 ;Number of words in each ALDOPS entry
II == II + 2
.MACRO MAKEOP CNAME, ANAME ;Compiler name, Address name
II == .
0 ;ALDFLG
0 ;ALDWHO
.RAD50 /ANAME/ ;ALDPNM
. = II + 2*OPSLTH ;Just in case the ANAME was funny
.ENDM
; The interpreter operation debug table
ALDOPS: MAKEOP XINVALID,INVALD ;Illegal instruction
.INSRT INTOPS.PAL[HAL,HE]
ALDINT: ;The psop is in R0.
MOV #OPSLTH,R1 ;
MUL R0,R1 ;
ADD #ALDOPS,R1 ;
MOV R1,R2 ;R2 ← pointer into ALDOPS
BIT #ALDTRC+ALDBRK,ALDFLG(R2) ;Tracing or breaking?
BEQ ALDIN1 ;Yes
ALDIN2: RTS PC ;No. Done.
ALDIN1: MOV #CRLFX,R0 ;Yes. New line
JSR PC,TYPSTR ;
MOV #INTMS5,R0 ;
JSR PC,TYPSTR ;
MOV ALDPNM(R2),R0;Type name of psop
JSR PC,TYPR50 ;
MOV ALDPNM+2(R2),R0;
JSR PC,TYPR50 ;
MOV #INTMS6,R0 ;" "
JSR PC,TYPSTR ;
MOV IPC(R4),R0 ;Type PIC
JSR PC,TYPOCT ;
BIT #ALDBRK,ALDFLG(R2) ;Break?
BNE ALDIN2 ;No
MOV #INTMS4,R0 ;
JSR PC,TYPSTR ;
BPT ;Breakpoint to DDT.
RTS PC ;Done
INTMS4: ASCIE / :BRK:/
INTMS5: ASCIE /:AT: /
INTMS6: ASCIE / /
.ENDC ALAID